<?php


namespace App\Models;


use Askedio\SoftCascade\Traits\SoftCascadeTrait;
use Illuminate\Database\Eloquent\SoftDeletes;

class WarehouseSiteModel extends BaseModel
{
    use SoftDeletes;
    use SoftCascadeTrait;

    protected $softCascade = ['WarehouseSiteRelation'];

    protected $primaryKey = 'site_id';
    protected $table = 'warehouse_site';

    public function WarehouseShelf()
    {
        return $this->belongsTo(WarehouseShelfModel::class, 'shelf_id', 'shelf_id');
    }

    public function ProductBatch()
    {
        return $this->belongsToMany(ProductsBatchModel::class, 'warehouse_site_batch', 'site_id', 'batch_id')->withTimestamps();
    }

    public function WarehouseSiteRelation()
    {
        return $this->hasMany(WarehouseRelationModel::class, 'site_id', 'site_id');
    }

}
